package fr.insatoulouse.uvmanager.grb.DataBase;

import java.util.ArrayList;
import java.util.Iterator;

import fr.insatoulouse.uvmanager.grb.uvmanager.Assignment;
import fr.insatoulouse.uvmanager.grb.uvmanager.UV;
import junit.framework.TestCase;

public class PrintDataBase extends TestCase {
	
	Manager mg= new Manager(); 
	
	
	/**
	 * Prints out all the UVs and the assignments to each of the UVs
	 */
	public void testAffichageUVs(){
		int counter =0;
		int counter2 = 0;
		for (int i=1;i<=5;i++){
			System.out.println("************************ PROMO "+i+" ************************ ");
			ArrayList<UV> uvs = mg.getPromo(i);
			Iterator<UV> it = uvs.iterator();
			while (it.hasNext()){
				UV uv = it.next();
				counter++;
				System.out.println(uv);
				
				ArrayList<Assignment> assignments = mg.getUVAssignments(uv.getId());
				Iterator<Assignment> it2 = assignments.iterator();
				
				while (it2.hasNext()){
					counter2 ++;
					System.out.println(it2.next());
				}
				
				
			}
		}
		System.out.println("************************* TOTAL *************************");
		System.out.println("\n"+counter+" UVs in total.\n"+counter2+" assignments in total.");
	}
	
}
